package splug.cjk;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class BBSComment extends Activity{

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setTitle("댓글달기");
		setContentView(R.layout.bbs_comment);

		Button btn_ok = (Button) findViewById(R.id.btn_bbs_carpool_comment_ok);
		Button btn_cancel = (Button) findViewById(R.id.btn_bbs_carpool_comment_cancel);
		final EditText text = (EditText) findViewById(R.id.text_carpool_comment);

		btn_ok.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				String comment = text.getText().toString();

				if(comment.length() > 100){
					Toast.makeText(BBSComment.this, "내용은 100자까지만 가능합니다", Toast.LENGTH_SHORT).show();
				}
				else{
					Intent intent = getIntent();
					intent.putExtra("COMMENT", comment);
					setResult(RESULT_OK, intent);
					finish();
				}
			}
		});

		btn_cancel.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				finish();
			}
		});
	}

}
